<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>我的需求</title>
		<link rel="stylesheet" href="<%=request.getContextPath()%>/js/layui-v1.0.9_rls/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="<%=request.getContextPath()%>/js/layui-v1.0.9_rls/layui/css/global.css" media="all">
		<link rel="stylesheet" href="<%=request.getContextPath()%>/js/plugins/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="<%=request.getContextPath()%>/js/layui-v1.0.9_rls/layui/css/table.css" />
		<link rel="stylesheet" href="<%=request.getContextPath()%>/css/file.css" media="all" />
		
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/layui-v1.0.9_rls/layui/layui.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/util.js"></script>
	
	
	</head>
	<style>
		body {
			background-color: white;
		}
		
	</style>

	<body>
		<!-- 下载用的隐藏iframe -->
		<iframe src="" name="down_frame" id="down_frame" style="display:none"
			frameborder="0" scrolling="auto">
		</iframe> 
		
		<div class="admin-main">
			<fieldset class="layui-elem-field">
				<legend  class="legendCss">查询条件</legend>
				<div class="layui-field-box layui-form">
					<form class="layui-form" >
			
						<div class="layui-form-item">
						
								<label class="layui-form-label">需求名称：</label>
								<div class="layui-input-inline">
									<input type="hidden" name="createNo" value="<s:property value="reqInfo.createNo"/>"  class="layui-input"/>
									<input type="tel" name="reqName" lay-verify="" autocomplete="off" class="layui-input">
								</div>
								<label class="layui-form-label">起止日期：从</label>
							
								<div class="layui-input-inline" >
									<input type="text" name="fromDate" id="date" placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
								</div>
								<label class="layui-form-label">至</label>
								<div class="layui-input-inline">
									<input type="text" name="toDate" id="date" placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
								</div>
								
								<div class="layui-input-inline">
									<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="queryBtn" id="queryBtn">查询</button>
									<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="expBtn" id="expBtn">导出</button>
								</div>
							</div>
					</form>
				</div>
					
			</fieldset>

			<fieldset class="layui-elem-field">
				<legend class="legendCss">需求列表</legend>
				<div class="layui-field-box layui-form">
					<table class="layui-table admin-table">
						<thead>
							<tr>
								<th>需求地市</th>
								<th>需求名称</th>
								<th>状态</th>
								<th>提出人</th>
								<th>提出时间</th>
								<th>需求分类</th>
								<th>需求描述</th>
								<th>要求完成时间</th>
								<th>厂家确认完成时间</th>
								<th>厂家责任人</th>
								<th>是否按时完成</th>
								<th>是否超期</th>
								<th>超期原因</th>
								<th>需求人确认可超期天数</th>
								<th>实际超期天数</th>
								<th>完成情况</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody id="content">
							
						
						</tbody>
					</table>
				</div>
			</fieldset>
			<div class="admin-table-page">
				<div id="paged" class="page">
				</div>
			</div>
		</div>


		<script>
		
		
			//拼接界面的table分页，没个界面自己写
			function render(reqList,pageNum,curr){
								
					if(reqList.length != 0){
					
						var last = curr * pageNum - 1;
						last = last >= reqList.length ? (reqList.length - 1) : last;
						
						var tbodyStr = ""	
						for(var i = (curr * pageNum - pageNum); i <= last; i++) {
							var reqInfo = reqList[i];
							tbodyStr = tbodyStr + "<tr><td>"+reqInfo.regionName+"</td><td>"+reqInfo.reqName+"</td><td>"+reqInfo.stsDesc+"</td><td>"+reqInfo.createName+"</td><td>"+reqInfo.createTime+"</td><td>"+reqInfo.reqTypeDesc+"</td><td>"+reqInfo.reqDesc+"</td><td>"+util.getVal(reqInfo.requiredTime)+"</td><td>"+util.getVal(reqInfo.serviceTime)+"</td><td>"+util.getVal(reqInfo.serviceName)+"</td><td>"+util.getVal(reqInfo.timeFlag)+"</td><td>"+util.getVal(reqInfo.overFlag)+"</td><td>"+util.getVal(reqInfo.overReason)+"</td><td>"+util.getVal(reqInfo.permitDay)+"</td><td>"+util.getVal(reqInfo.overDay)+"</td><td>"+util.getVal(reqInfo.finishDesc)+"</td><td><a data-opt='edit' class='layui-btn layui-btn-mini' href='javascript:void(0)' onclick=viewReqDetail('"+reqInfo.reqNo+"')>查看</a></td></tr>";
						}
					}
					
					return tbodyStr;
			}
			
		$(document).ready(function(){
			layui.use([ 'laypage', 'form', 'laydate'], function() {
			
				var $ = layui.jquery,
					laypage = layui.laypage,
					layerTips = parent.layer === undefined ? layui.layer : parent.layer, //获取父窗口的layer对象
					layer = layui.layer, //获取当前窗口的layer对象
					laydate = layui.laydate,
					form = layui.form();
					
					//监听提交
					form.on('submit(queryBtn)', function(data) {
					
						//获取参数
						$.post("<%=request.getContextPath()%>/rms/queryMyReqList",
						
								{
									"reqInfo.reqName":data.field.reqName,
									"reqInfo.fromDate":data.field.fromDate,
									"reqInfo.toDate":data.field.toDate,
									"reqInfo.createNo":data.field.createNo
								},
								
							function(data){
							
									var reqList = data.reqList;
								
									//var colArr = ["reqNo","reqName"];
									util.paging(data.reqList,10,"content","paged",3);
							
							
						},"json");
						
			
						return false;
					});
					
					
					//监听导出按钮
					form.on('submit(expBtn)', function(data) {
					
						//获取参数
						util.expExcel("<%=request.getContextPath()%>/rms/expReqList", "reqInfo",["reqName","fromDate","toDate","createNo"],data);				
						
			
						return false;
					});
					
								
			
					//触发查询事件
					$("#queryBtn").click();
			});
			
			});
			
			function viewReqDetail(reqNo){
			
				util.openDivWin("<%=request.getContextPath()%>/rms/viewMyReq?reqInfo.reqNo="+reqNo,"我的需求",800,600);
			}

		
		</script>
	</body>

</html>